package
{
	import flash.events.Event;
	import flash.utils.Dictionary;
	
	import org.flixel.FlxGroup;

	public class AchievementSystem
	{
		protected static var TUTORIAL_COMPLETE:int = 0;
		protected static var GRASS_COMPLETE:int = 1;
		protected static var WASTE_COMPLETE:int = 2;
		protected static var VOID_COMPLETE:int = 3;
		protected static var STORY_COMPLETE:int = 4;
		protected static var CHICKEN_ONE:int = 5;
		protected static var CHICKEN_TWO:int = 6;
		protected static var CHICKEN_THREE:int = 7;
		protected static var MONSTER_ONE:int = 8;
		protected static var MONSTER_TWO:int = 9;
		protected static var MONSTER_THREE:int = 10;
		protected static var PACIFIST:int = 11;
		protected static var SUBMITTED_PUZZLE:int = 12;
		protected static var SUBMITTED_PUZZLE_MULTI:int = 13;
		protected static var FRIEND_PUZZLE:int = 14;
		protected static var FRIEND_PUZZLE_MULTI:int = 15;
		protected static var INVITE_ONE:int = 16;
		protected static var INVITE_TWO:int = 17;
		protected static var INVITE_THREE:int = 18;
		protected static var CHALLENGE_ONE:int = 19;
		protected static var CHALLENGE_TWO:int = 20;
		protected static var CHALLENGE_THREE:int = 21;
		protected static var VICTOR_ONE:int = 22;
		protected static var VICTOR_TWO:int = 23;
		protected static var VICTOR_THREE:int = 24;
		
		protected var icons:Dictionary = new Dictionary();
		protected var requirements:Dictionary = new Dictionary();
		protected var incompleteText:Dictionary = new Dictionary();
		protected var completedText:Dictionary = new Dictionary();
		protected var progress:Dictionary = new Dictionary();
		
		
		protected var unreportedAchieves:Array;
		protected var numAchievs:int;
		
		protected var l:int;
		protected var m:int;
		protected var c:int;
		protected var cB:int;
		protected var cI:int;
		protected var p:int;
		protected var mC:int;
		protected var mB:int;
		protected var fB:int;
		protected var inv:int;
		
		protected var dl:int;
		protected var dm:int;
		protected var dc:int;
		
		protected var forFriends:Boolean;
		
		public function AchievementSystem(forFriends:Boolean = false)
		{
			this.forFriends = forFriends;
			numAchievs = 25;
			unreportedAchieves = new Array();
			init();
		}
		
		private function init():void {
			
			icons[TUTORIAL_COMPLETE] = Res.achiev0;
			requirements[TUTORIAL_COMPLETE] = 1;
			if (!forFriends) {
				incompleteText[TUTORIAL_COMPLETE] = "You have not made it past level 5...";
				completedText[TUTORIAL_COMPLETE] = "Proved Your Worth! Magnifico is proud you completed level 5.";
			} else {
				incompleteText[TUTORIAL_COMPLETE] = "They have not made it past level 5...";
				completedText[TUTORIAL_COMPLETE] = "Proved Their Worth! Magnifico is proud they completed level 5.";
			}
			progress[TUTORIAL_COMPLETE] = 0;    
			
			icons[GRASS_COMPLETE] = Res.achiev1;
			requirements[GRASS_COMPLETE] = 1;
			if (!forFriends) {
				incompleteText[GRASS_COMPLETE] = "You have not made it past level 15...";
				completedText[GRASS_COMPLETE] = "For the Chickens! Completed all grass levels.";
			} else {
				incompleteText[GRASS_COMPLETE] = "They have not made it past level 15...";
				completedText[GRASS_COMPLETE] = "For the Chickens! Completed all grass levels.";
			}
			progress[GRASS_COMPLETE] = 0;
			
			icons[WASTE_COMPLETE] = Res.achiev2;
			requirements[WASTE_COMPLETE] = 1;
			if (!forFriends) {
				incompleteText[WASTE_COMPLETE] = "You have not made it past level 30...";
				completedText[WASTE_COMPLETE] = "Waste Not Want Not! Completed all wastes levels.";
			} else {
				incompleteText[WASTE_COMPLETE] = "They have not made it past level 30...";
				completedText[WASTE_COMPLETE] = "Waste Not Want Not! Completed all wastes levels.";
			}
			progress[WASTE_COMPLETE] = 0;
			
			icons[VOID_COMPLETE] = Res.achiev3;
			requirements[VOID_COMPLETE] = 1;
			if (!forFriends) {
				incompleteText[VOID_COMPLETE] = "You have not made it past level 40...";
				completedText[VOID_COMPLETE] = "One with Void Walkers! Completed all void levels.";
			} else {
				incompleteText[VOID_COMPLETE] = "They have not made it past level 40...";
				completedText[VOID_COMPLETE] = "One with Void Walkers! Completed all void levels.";
			}
			progress[VOID_COMPLETE] = 0;
			
			icons[STORY_COMPLETE] = Res.achiev4;
			requirements[STORY_COMPLETE] = 1;
			if (!forFriends) {
				incompleteText[STORY_COMPLETE] = "You have not finished Story Mode...";
				completedText[STORY_COMPLETE] = "You Voided the Void! Story Complete.";
			} else {
				incompleteText[STORY_COMPLETE] = "They have not finished Story Mode...";
				completedText[STORY_COMPLETE] = "They Voided the Void! Story Complete.";
			}
			progress[STORY_COMPLETE] = 0;
			
			icons[CHICKEN_ONE] = Res.achiev5;
			requirements[CHICKEN_ONE] = 20;
			if (!forFriends) {
				incompleteText[CHICKEN_ONE] = "Throw 20 chickens to unlock.";
				completedText[CHICKEN_ONE] = "Chicken Flingers! You have thrown 20 chickens.";
			} else {
				incompleteText[CHICKEN_ONE] = "Throw 20 chickens to unlock.";
				completedText[CHICKEN_ONE] = "Chicken Flingers! They have thrown 20 chickens.";
			}
			progress[CHICKEN_ONE] = 0;
			
			icons[CHICKEN_TWO] = Res.achiev6;
			requirements[CHICKEN_TWO] = 50;
			if (!forFriends) {
				incompleteText[CHICKEN_TWO] = "Throw 50 chickens to unlock.";
				completedText[CHICKEN_TWO] = "Chicken Launcher! You have thrown 50 chickens.";
			} else {
				incompleteText[CHICKEN_TWO] = "Throw 50 chickens to unlock.";
				completedText[CHICKEN_TWO] = "Chicken Launcher! They have thrown 50 chickens.";
			}
			progress[CHICKEN_TWO] = 0;
			
			icons[CHICKEN_THREE] = Res.achiev7;
			requirements[CHICKEN_THREE] = 100;
			if (!forFriends) {
				incompleteText[CHICKEN_THREE] = "Throw 100 chickens to unlock.";
				completedText[CHICKEN_THREE] = "Chicken Chucker! You have thrown 100 chickens.";
			} else {
				incompleteText[CHICKEN_THREE] = "Throw 100 chickens to unlock.";
				completedText[CHICKEN_THREE] = "Chicken Chucker! They have thrown 100 chickens.";
			}
			progress[CHICKEN_THREE] = 0;
			
			icons[MONSTER_ONE] = Res.achiev8;
			requirements[MONSTER_ONE] = 20;
			if (!forFriends) {
				incompleteText[MONSTER_ONE] = "Defeat 20 Monsters to unlock.";
				completedText[MONSTER_ONE] = "Monster Mangler! You have killed 20 monsters.";
			} else {
				incompleteText[MONSTER_ONE] = "Defeat 20 Monsters to unlock.";
				completedText[MONSTER_ONE] = "Monster Mangler! They have killed 20 monsters.";
			}
			progress[MONSTER_ONE] = 0;
			
			icons[MONSTER_TWO] = Res.achiev9;
			requirements[MONSTER_TWO] = 50;
			if (!forFriends) {
				incompleteText[MONSTER_TWO] = "Defeat 50 Monsters to unlock.";
				completedText[MONSTER_TWO] = "Monster Mincer! You have killed 50 monsters.";
			} else {
				incompleteText[MONSTER_TWO] = "Defeat 50 Monsters to unlock.";
				completedText[MONSTER_TWO] = "Monster Mincer! They have killed 50 monsters.";
			}
			progress[MONSTER_TWO] = 0;
			
			icons[MONSTER_THREE] = Res.achiev10;
			requirements[MONSTER_THREE] = 100;
			if (!forFriends) {
				incompleteText[MONSTER_THREE] = "Defeat 100 Monsters to unlock.";
				completedText[MONSTER_THREE] = "Monster Mash! You have killed 100 monsters.";
			} else {
				incompleteText[MONSTER_THREE] = "Defeat 100 Monsters to unlock.";
				completedText[MONSTER_THREE] = "Monster Mash! They have killed 100 monsters.";
			}
			progress[MONSTER_THREE] = 0;
			
			icons[PACIFIST] = Res.achiev11;
			requirements[PACIFIST] = 1;
			incompleteText[PACIFIST] = "They won't bite...";
			completedText[PACIFIST] = "Nature Lover! Completed a monster level without killing a monster.";
			progress[PACIFIST] = 0;
			
			icons[SUBMITTED_PUZZLE] = Res.achiev12;
			requirements[SUBMITTED_PUZZLE] = 1;
			if (!forFriends) {
				incompleteText[SUBMITTED_PUZZLE] = "Create and Share your own Puzzle!";
				completedText[SUBMITTED_PUZZLE] = "Giving Back! Created and submitted your first puzzle.";
			} else {
				incompleteText[SUBMITTED_PUZZLE] = "Create and Share their own Puzzle!";
				completedText[SUBMITTED_PUZZLE] = "Giving Back! Created and submitted their first puzzle.";
			}
			progress[SUBMITTED_PUZZLE] = 0;
			
			icons[SUBMITTED_PUZZLE_MULTI] = Res.achiev13;
			requirements[SUBMITTED_PUZZLE_MULTI] = 5;
			incompleteText[SUBMITTED_PUZZLE_MULTI] = "Create and Share 5 Puzzles!";
			completedText[SUBMITTED_PUZZLE_MULTI] = "Tile by Tile! Created and submitted 5 puzzles.";
			progress[SUBMITTED_PUZZLE_MULTI] = 0;
			
			icons[FRIEND_PUZZLE] = Res.achiev14;
			requirements[FRIEND_PUZZLE] = 1;
			if (!forFriends) {
				incompleteText[FRIEND_PUZZLE] = "Visit a friend and play one of their puzzles!";
				completedText[FRIEND_PUZZLE] = "Social Poof! Played your first friend puzzle.";
			} else {
				incompleteText[FRIEND_PUZZLE] = "Visit a friend and play one of their puzzles!";
				completedText[FRIEND_PUZZLE] = "Social Poof! Played their first friend puzzle.";
			}
			progress[FRIEND_PUZZLE] = 0;
			
			icons[FRIEND_PUZZLE_MULTI] = Res.achiev15;
			requirements[FRIEND_PUZZLE_MULTI] = 5;
			incompleteText[FRIEND_PUZZLE_MULTI] = "Visit friends and play 5 of their puzzles!";
			completedText[FRIEND_PUZZLE_MULTI] = "The Gregarious One! Played 5 friend puzzles.";
			progress[FRIEND_PUZZLE_MULTI] = 0;
			
			icons[INVITE_ONE] = Res.achiev16;
			requirements[INVITE_ONE] = 1;
			if (!forFriends) {
				incompleteText[INVITE_ONE] = "Invite a friend to Poofed!";
				completedText[INVITE_ONE] = "Pass it on! You invited your first friend to play.";
			} else {
				incompleteText[INVITE_ONE] = "Invite a friend to Poofed!";
				completedText[INVITE_ONE] = "Pass it on! They invited their first friend to play.";
			}
			progress[INVITE_ONE] = 0;
			
			icons[INVITE_TWO] = Res.achiev17;
			requirements[INVITE_TWO] = 3;
			if (!forFriends) {
				incompleteText[INVITE_TWO] = "Invite more friends to Poofed!";
				completedText[INVITE_TWO] = "Party Thrower! You invited a lot friends to play.";
			} else {
				incompleteText[INVITE_TWO] = "Invite more friends to Poofed!";
				completedText[INVITE_TWO] = "Party Thrower! They invited a lot friends to play.";
			}
			progress[INVITE_TWO] = 0;
			
			icons[INVITE_THREE] = Res.achiev18;
			requirements[INVITE_THREE] = 7;
			if (!forFriends) {
				incompleteText[INVITE_THREE] = "Invite more friends to Poofed!";
				completedText[INVITE_THREE] = "Poofed Evangelical! You spread the good news to tons friends.";
			} else {
				incompleteText[INVITE_THREE] = "Invite more friends to Poofed!";
				completedText[INVITE_THREE] = "Poofed Evangelical! They spread the good news to tons friends.";
			}
			progress[INVITE_THREE] = 0;
			
			icons[CHALLENGE_ONE] = Res.achiev19;
			requirements[CHALLENGE_ONE] = 1;
			if (!forFriends) {
				incompleteText[CHALLENGE_ONE] = "Challenge a friend to beat a tough puzzle!";
				completedText[CHALLENGE_ONE] = "It's a Date! You challenged a friend to a puzzle.";
			} else {
				incompleteText[CHALLENGE_ONE] = "Challenge a friend to beat a tough puzzle!";
				completedText[CHALLENGE_ONE] = "It's a Date! They challenged a friend to a puzzle.";
			}
			progress[CHALLENGE_ONE] = 0;
			
			icons[CHALLENGE_TWO] = Res.achiev20;
			requirements[CHALLENGE_TWO] = 5;
			incompleteText[CHALLENGE_TWO] = "Challenge a friend to 5 puzzles!";
			completedText[CHALLENGE_TWO] = "Can't Be Done! Challenged friends to 5 puzzles.";
			progress[CHALLENGE_TWO] = 0;
			
			icons[CHALLENGE_THREE] = Res.achiev21;
			requirements[CHALLENGE_THREE] = 10;
			incompleteText[CHALLENGE_THREE] = "Challenge a friend to 10 puzzles!";
			completedText[CHALLENGE_THREE] = "The Gauntlet is Set! Challenged friends to 10 puzzles.";
			progress[CHALLENGE_THREE] = 0;
			
			icons[VICTOR_ONE] = Res.achiev22;
			requirements[VICTOR_ONE] = 1;
			if (!forFriends) {
				incompleteText[VICTOR_ONE] = "Complete a puzzle challenge from your friends!";
				completedText[VICTOR_ONE] = "No Problem! Beat a puzzle challenge.";
			} else {
				incompleteText[VICTOR_ONE] = "Complete a puzzle challenge from their friends!";
				completedText[VICTOR_ONE] = "No Problem! Beat a puzzle challenge.";
			}
			progress[VICTOR_ONE] = 0;
			
			icons[VICTOR_TWO] = Res.achiev23;
			requirements[VICTOR_TWO] = 5;
			if (!forFriends) {
				incompleteText[VICTOR_TWO] = "Complete 5 puzzle challenges from your friends!";
				completedText[VICTOR_TWO] = "Can't Touch This! Beat 5 puzzle challenges.";
			} else {
				incompleteText[VICTOR_TWO] = "Complete 5 puzzle challenges from their friends!";
				completedText[VICTOR_TWO] = "Can't Touch This! Beat 5 puzzle challenges.";
			}
			progress[VICTOR_TWO] = 0;
			
			icons[VICTOR_THREE] = Res.achiev24;
			requirements[VICTOR_THREE] = 10;
			if (!forFriends) {
				incompleteText[VICTOR_THREE] = "Complete 10 puzzle challenges from your friends!";
				completedText[VICTOR_THREE] = "UNSTOPPABLE! Beat 10 puzzle challenges.";
			} else {
				incompleteText[VICTOR_THREE] = "Complete 10 puzzle challenges from their friends!";
				completedText[VICTOR_THREE] = "UNSTOPPABLE! Beat 10 puzzle challenges.";
			}
			progress[VICTOR_THREE] = 0;
		}
		
		public function initializeWithStats(l:int, m:int, c:int, cB:int, cI:int, p:int, mC:int, mB:int, fB:int, inv:int):void {
			this.l = l;
			this.m = m;
			this.c = c;
			this.cB = cB;
			this.cI= cI;
			this.p= p;
			this.mC = mC;
			this.mB = mB;
			this.fB = fB;
			this.inv = inv;
			
			//store changes for stats which need to be updated manually
			//reset to 0 each time changes are uploaded. keeps track of diff
			dl = 0;
			dm = 0;
			dc = 0;
			
			
			if (l >= 5) 			progress[TUTORIAL_COMPLETE] = 1;    
			if (l >= 15) 		progress[GRASS_COMPLETE] = 1;
			if (l >= 30) 		progress[WASTE_COMPLETE] = 1;
			if (l >= 40) {
				progress[VOID_COMPLETE] = 1;
				progress[STORY_COMPLETE] = 1;
			}
			
			progress[MONSTER_ONE] = m;
			progress[MONSTER_TWO] = m;
			progress[MONSTER_THREE] = m;
			
			progress[CHICKEN_ONE] = c;
			progress[CHICKEN_TWO] = c;
			progress[CHICKEN_THREE] = c;
			
			progress[VICTOR_ONE] = cB;
			progress[VICTOR_TWO] = cB;
			progress[VICTOR_THREE] = cB;
			
			progress[CHALLENGE_ONE] = cI;
			progress[CHALLENGE_TWO] = cI;
			progress[CHALLENGE_THREE] = cI;
			
			progress[PACIFIST] = p;
			
			progress[SUBMITTED_PUZZLE] = mC;
			progress[SUBMITTED_PUZZLE_MULTI] = mC;
			
			progress[FRIEND_PUZZLE] = fB;
			progress[FRIEND_PUZZLE_MULTI] = fB;
			
			progress[INVITE_ONE] = inv;
			progress[INVITE_TWO] = inv;
			progress[INVITE_THREE] = inv;
		}

		
		public function updateStoryLevel(level:int):void  {
			if (level == 5) {
				progress[TUTORIAL_COMPLETE]++;
				if (checkCompletion(TUTORIAL_COMPLETE)) {
					unreportedAchieves.push(TUTORIAL_COMPLETE);
				}
			} else if (level == 15) {
				progress[GRASS_COMPLETE]++;
				if (checkCompletion(GRASS_COMPLETE)) {
					unreportedAchieves.push(GRASS_COMPLETE);
				}
			} else if (level == 30) {
				progress[WASTE_COMPLETE]++;
				if (checkCompletion(WASTE_COMPLETE)) {
					unreportedAchieves.push(WASTE_COMPLETE);
				}
			} else if (level == 40) {
				progress[STORY_COMPLETE]++;
				if (checkCompletion(STORY_COMPLETE)) {
					unreportedAchieves.push(STORY_COMPLETE);
				}
				progress[VOID_COMPLETE]++;
				if (checkCompletion(VOID_COMPLETE)) {
					unreportedAchieves.push(VOID_COMPLETE);
				}
			}
			
			if (level > l) {
				dl = level - l;
				l = level;
				trace("level " + level);
				trace("l " + l);
				trace("dl " + dl);
			}
			if (dl != 0) {
				Client.updatePlayerStat(Elemental.fbInfo.userID,"level",dl, handleReply);
				dl = 0;
			}
		}
		
		public function updateKill():void {
			dm++;
			m++;
			progress[MONSTER_ONE]++;
			if (checkCompletion(MONSTER_ONE)) {
				unreportedAchieves.push(MONSTER_ONE);
				uploadChanges();
			}
			
			progress[MONSTER_TWO]++;
			if (checkCompletion(MONSTER_TWO)) {
				unreportedAchieves.push(MONSTER_TWO);
				uploadChanges();
			}
			
			progress[MONSTER_THREE]++;
			if (checkCompletion(MONSTER_THREE)) {
				unreportedAchieves.push(MONSTER_THREE);
				uploadChanges();
			}
			if (dm > 5) {
				uploadChanges();
			}
		}
		
		public function updateCompletedPlayerPuzzle():void {
			mB++;
			uploadChanges();
		}
		
		public function updateFriendPuzzleBeat():void {
			progress[FRIEND_PUZZLE]++;
			if (checkCompletion(FRIEND_PUZZLE)) {
				unreportedAchieves.push(FRIEND_PUZZLE);
			}
			progress[FRIEND_PUZZLE_MULTI]++;
			if (checkCompletion(FRIEND_PUZZLE_MULTI)) {
				unreportedAchieves.push(FRIEND_PUZZLE_MULTI);
			}
			Client.updatePlayerStat(Elemental.fbInfo.userID,"friends_puzzles",1, handleReply);
			uploadChanges();
		}
		
		public function updateCreatePuzzle():void {
			mC++;
			progress[SUBMITTED_PUZZLE]++;
			if (checkCompletion(SUBMITTED_PUZZLE)) {
				unreportedAchieves.push(SUBMITTED_PUZZLE);
			}
			progress[SUBMITTED_PUZZLE_MULTI]++;
			if (checkCompletion(SUBMITTED_PUZZLE_MULTI)) {
				unreportedAchieves.push(SUBMITTED_PUZZLE_MULTI);
			}
		}
		
		public function updateFriendInvited():void {
			progress[INVITE_ONE]++;
			if (checkCompletion(INVITE_ONE)) {
				unreportedAchieves.push(INVITE_ONE);
			}
			progress[INVITE_TWO]++;
			if (checkCompletion(INVITE_TWO)) {
				unreportedAchieves.push(INVITE_TWO);
			}
			progress[INVITE_THREE]++;
			if (checkCompletion(INVITE_THREE)) {
				unreportedAchieves.push(INVITE_THREE);
			}
			Client.updatePlayerStat(Elemental.fbInfo.userID,"invites",1, handleReply);
		}
		
		public function updateChickenThrown():void {
			dc++;
			c++;
			progress[CHICKEN_ONE]++;
			if (checkCompletion(CHICKEN_ONE)) {
				unreportedAchieves.push(CHICKEN_ONE);
				uploadChanges();
			}
			progress[CHICKEN_TWO]++;
			if (checkCompletion(CHICKEN_TWO)) {
				unreportedAchieves.push(CHICKEN_TWO);
				uploadChanges();
			}
			progress[CHICKEN_THREE]++;
			if (checkCompletion(CHICKEN_THREE)) {
				unreportedAchieves.push(CHICKEN_THREE);
				uploadChanges();
			}
			
			if (dc > 5) {
				uploadChanges();
			}
		}
		
		public function updatePacifist():void {
			progress[PACIFIST]++;
			if (checkCompletion(PACIFIST)) {
				unreportedAchieves.push(PACIFIST);
				Client.updatePlayerStat(Elemental.fbInfo.userID,"pacifist",1, handleReply);
			}
		}
		
		public function updateChallengeSent():void {
			cI++;
			progress[CHALLENGE_ONE]++;
			if (checkCompletion(CHALLENGE_ONE)) {
				unreportedAchieves.push(CHALLENGE_ONE);
			}
			progress[CHALLENGE_TWO]++;
			if (checkCompletion(CHALLENGE_TWO)) {
				unreportedAchieves.push(CHALLENGE_TWO);
			}
			progress[CHALLENGE_THREE]++;
			if (checkCompletion(CHALLENGE_THREE)) {
				unreportedAchieves.push(CHALLENGE_THREE);
			}
		}
		
		public function updateChallengeBeat():void {
			cB++;
			progress[VICTOR_ONE]++;
			if (checkCompletion(VICTOR_ONE)) {
				unreportedAchieves.push(VICTOR_ONE);
			}
			progress[VICTOR_TWO]++;
			if (checkCompletion(VICTOR_TWO)) {
				unreportedAchieves.push(VICTOR_TWO);
			}
			progress[VICTOR_THREE]++;
			if (checkCompletion(VICTOR_THREE)) {
				unreportedAchieves.push(VICTOR_THREE);
			}
			uploadChanges();
		}
		
		public function getAchievement(a:int):AchievementInfo {
			return new AchievementInfo(icons[a], completedText[a], incompleteText[a], requirements[a], progress[a]);
		}
		
		public function numberOfAchievements():int {
			return numAchievs;
		}
		
		public function hasAchievementToReport():Boolean {
			return unreportedAchieves.length > 0;
		}
		
		public function getNextAchievementToReport():AchievementReport {
			return new AchievementReport(unreportedAchieves.pop());
		}
		
		private function checkCompletion(achievement:int):Boolean {
			return requirements[achievement] == progress[achievement];
		}
		
		private function uploadChanges():void {
			if (dm != 0) {
				Client.updatePlayerStat(Elemental.fbInfo.userID,"monsters",dm, handleReply);
				dm = 0;
			}
			if (dc != 0) {
				Client.updatePlayerStat(Elemental.fbInfo.userID,"chickens",dc, handleReply);
				dc = 0;
			}
			//log the challenge achieved at time ... with stats.
		}
		
		private function handleReply(e:Event):void {
			trace(e.target.data);
		}
		
		public function getStoryLevelReached():int {
			return l;
		}
		
		public function getChickensThrown():int {
			return c;
		}
		
		public function getMonstersKilled():int {
			return m;	
		}
		
		public function getPlayerMapsBeaten():int {
			return mB;
		}
		
		public function getMapsCreated():int {
			return mC;
		}
		
		public function getFriendMapsBeaten():int {
			return fB;	
		}
		
		public function getChallengesBeaten():int {
			return cB;
		}
		
		public function getChallengesIssued():int {
			return cI;	
		}
		//invite and sent are left
	}
}